//
// lightwell - Another demonstration for irrlicht
// Copyright (c) Jean-manuel Clemencon
//
//
#include <stdio.h>
#include <irrXML.h>
#include <string.h>

#include <string>
#include <iostream>
#include <cstdlib>

#include "config_load.hpp"

using namespace std;
using namespace irr; // irrXML is located 
using namespace io;  // in the namespace irr::io


ConfigurationLoad::ConfigurationLoad(string file = "config.xml")
{
    filename = file;
}

void ConfigurationLoad::parse()
{
    // we use irrXML to read the xml config file
    IrrXMLReader* xml = createIrrXMLReader(filename.c_str());
    
    // parse the file until end is reached
    while(xml && xml->read())
    {
        switch(xml->getNodeType())
        {
        case EXN_ELEMENT:
            if (!strcmp("Video", xml->getNodeName()))
        {
		width  = atoi(xml->getAttributeValue("width"));
                height = atoi(xml->getAttributeValue("height"));
	}
            break;
        }
    }
    delete xml;     
}
